package com.ailight.smart.ai.enums;

import lombok.Getter;

@Getter
public enum ModelEnums {

    /**
     * 自动模式
     */
    AUTO_MODE(1, "auto_mode", "自动模式可以自动调节光照",
            "autoLightOperationStrategy"),

    /**
     * 手动模式
     */
    MANUAL_M0DE(2, "manual_mode", "手动模式需要自己调节灯光","manualLightOperationStrategy"),

    ;
    /**
     * 模式类型
     */
    private final String model;

    /**
     * 模式code
     */
    private final int code;

    /**
     * 模式描述
     */
    private final String desc;

    private final String strategy;

    ModelEnums(int code, String model, String desc, String strategy) {
        this.model = model;
        this.code = code;
        this.desc = desc;
        this.strategy = strategy;
    }

    /**
     * @param modelName 模式名称，需要前端传递
     * @return 结果
     */
    public static ModelEnums getModelEnum(String modelName) {
        for (ModelEnums modelEnum : ModelEnums.values()) {
            if (modelEnum.getModel().equals(modelName)) {
                return modelEnum;
            }
        }
        // 返回默认值，防止出现空指针异常
        return MANUAL_M0DE;
    }
}
